package com.li.service;


import com.li.mapper.WeightMapper;
import com.li.pojo.Course2;
import com.li.pojo.Weight;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WeightService {
    @Autowired
    WeightMapper weightMapper;

    public Weight queryWeight(Weight weight){
        return weightMapper.queryWeight(weight);
    }

    public boolean addWeight(Weight weight){
        if(weightMapper.queryWeight(weight)==null){
            weightMapper.insertWeight(weight);
            return  true;
        }
        return false;
    }

    public boolean deleteWeight(Weight weight){
        if(weightMapper.queryWeight(weight)!=null){
            weightMapper.deleteWeight(weight);
            return  true;
        }
        return false;
    }
    public boolean updateWeight(Weight weight){
        weightMapper.updateWeight(weight);
        return  true;
    }
    public List<Weight> allWeight(){
        return weightMapper.listWeight();
    }
}

